package Kuaishou;

import java.util.ArrayList;
import java.util.List;


import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author leiwenkang <leiwenkang@kuaishou.com>
 * Created on 2020-12-18
 */
public class Test15循环耗时测试 {
    public static void main(String[] args) {
        int size = 5000000;
        List<Child> list = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            list.add(new Child(i, i));
        }
        long start = System.currentTimeMillis();
        list.parallelStream().forEach(child -> {
            child.setScore(child.getScore() + 1);
        });
        System.out.println(System.currentTimeMillis() - start);
    }
}

@AllArgsConstructor
@Data
class Child {
    long id;
    long score;
}
